// 配置文件初始化
import packageconfig from './config.package';
import globalconfig from './config.global';

class config {
    constructor(options) {
        options = options || {};
        this.config = Object.assign(globalconfig, options);
        this.config.package = [];
        for (let i = 0; i < packageconfig.length; i++) {
            let _packageconfig = packageconfig[i];
            if (this.config[packageconfig[i].key]) {
                _packageconfig.enable = this.config[packageconfig[i].key].enable;
                _packageconfig.parameter = Object.assign(_packageconfig.parameter,this.config[packageconfig[i].key].parameter);
                delete this.config[packageconfig[i].key];
            }
            if(_packageconfig.enable){
                this.config.package.push(_packageconfig);
            }
        }
    }
}
export default config;